package com.tdkj.model.shop;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Map;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MapKeyColumn;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;
import com.tdkj.model.user.BeanUser;

/**
 * 
 */
@Entity
@Table(name = "shop_good_snapshot")
public class BeanGoodSnapshot extends BaseEntity {

	private String typeName;
	
	//出售类型，0 1
	private Integer sellType;
	
	private Integer useType;
	private String name;
	
	private BigDecimal price;
	private String code;
	private Integer quantity;
	
	//加价幅度
	private BigDecimal rateOfIncrease;
	
	private String imgurl;
	
	private String keywords;
	
	private String detailDescription;
	
	private String state;
	
	private BeanUser user; 
	
	private Integer logisticsType ;
	
	private Double logisticsPrice ;
	
	private Map<String, String> properties;
	
	private Timestamp publishTime;
	
	private BeanGood good;
	
	/**
	 * @return the good
	 */
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="good_id")
	public BeanGood getGood() {
		return good;
	}
	/**
	 * @param good the good to set
	 */
	public void setGood(BeanGood good) {
		this.good = good;
	}
	/**
	 * @return the sellType
	 */
	public Integer getSellType() {
		return sellType;
	}
	/**
	 * @param sellType the sellType to set
	 */
	public void setSellType(Integer sellType) {
		this.sellType = sellType;
	}
	/**
	 * @return the useType
	 */
	public Integer getUseType() {
		return useType;
	}
	/**
	 * @param useType the useType to set
	 */
	public void setUseType(Integer useType) {
		this.useType = useType;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the price
	 */
	public BigDecimal getPrice() {
		return price;
	}
	/**
	 * @param price the price to set
	 */
	public void setPrice(BigDecimal price) {
		this.price = price;
	}
	/**
	 * @return the code
	 */
	public String getCode() {
		return code;
	}
	/**
	 * @param code the code to set
	 */
	public void setCode(String code) {
		this.code = code;
	}
	/**
	 * @return the quantity
	 */
	public Integer getQuantity() {
		return quantity;
	}
	/**
	 * @param quantity the quantity to set
	 */
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	/**
	 * @return the rateOfIncrease
	 */
	public BigDecimal getRateOfIncrease() {
		return rateOfIncrease;
	}
	/**
	 * @param rateOfIncrease the rateOfIncrease to set
	 */
	public void setRateOfIncrease(BigDecimal rateOfIncrease) {
		this.rateOfIncrease = rateOfIncrease;
	}
	/**
	 * @return the imgurl
	 */
	public String getImgurl() {
		return imgurl;
	}
	/**
	 * @param imgurl the imgurl to set
	 */
	public void setImgurl(String imgurl) {
		this.imgurl = imgurl;
	}
	/**
	 * @return the keywords
	 */
	public String getKeywords() {
		return keywords;
	}
	/**
	 * @param keywords the keywords to set
	 */
	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}
	/**
	 * @return the detailDescription
	 */
	public String getDetailDescription() {
		return detailDescription;
	}
	/**
	 * @param detailDescription the detailDescription to set
	 */
	public void setDetailDescription(String detailDescription) {
		this.detailDescription = detailDescription;
	}
	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}
	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}
	/**
	 * @return the user
	 */
	@ManyToOne(fetch=FetchType.EAGER)
	@JoinColumn(name="user_id")
	public BeanUser getUser() {
		return user;
	}
	/**
	 * @param user the user to set
	 */
	public void setUser(BeanUser user) {
		this.user = user;
	}
	/**
	 * @return the properties
	 */
	@ElementCollection
	@CollectionTable(name="shop_good_snapshot_properties",joinColumns={@JoinColumn(name="good_snapshot_id",referencedColumnName="id")})
	@MapKeyColumn(name="_key")
	@Column(name="_value")
	public Map<String, String> getProperties() {
		return properties;
	}
	/**
	 * @param properties the properties to set
	 */
	public void setProperties(Map<String, String> properties) {
		this.properties = properties;
	}
	
	/**
	 * @return the publishTime
	 */
	public Timestamp getPublishTime() {
		return publishTime;
	}
	/**
	 * @param publishTime the publishTime to set
	 */
	public void setPublishTime(Timestamp publishTime) {
		this.publishTime = publishTime;
	}
	/**
	 * @return the typeName
	 */
	public String getTypeName() {
		return typeName;
	}
	/**
	 * @param typeName the typeName to set
	 */
	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}
	/**
	 * @return the logisticsType
	 */
	public Integer getLogisticsType() {
		return logisticsType;
	}
	/**
	 * @param logisticsType the logisticsType to set
	 */
	public void setLogisticsType(Integer logisticsType) {
		this.logisticsType = logisticsType;
	}
	/**
	 * @return the logisticsPrice
	 */
	public Double getLogisticsPrice() {
		return logisticsPrice;
	}
	/**
	 * @param logisticsPrice the logisticsPrice to set
	 */
	public void setLogisticsPrice(Double logisticsPrice) {
		this.logisticsPrice = logisticsPrice;
	}

	
	
	
}